import { observable, action } from 'mobx'

class RequireListStore {
    @observable page={
        currentPage:1,
        pageSize:10
    }
    @observable requireList=[{
        id:"1",
        title:"“智领未来”中国数字经济高峰论坛",
        serviceType:"物品租赁",
        createTime:"2018-3-19 17:00:00",
    },{
        id:"2",
        title:"“中国智慧大健康产业发展高峰论坛",
        serviceType:"物品租赁",
        createTime:"2018-3-19 17:00:00",
    },{
        id:"3",
        title:"“i创杯”互联网创新创业大赛成果展示与路演",
        serviceType:"物品租赁",
        createTime:"2018-3-19 17:00:00",
    },{
        id:"4",
        title:"工业互联网创新发展高峰论坛",
        serviceType:"物品租赁",
        createTime:"2018-3-19 17:00:00",
    },{
        id:"5",
        title:"中国软件产业园区建设座谈会",
        serviceType:"物品租赁",
        createTime:"2018-3-19 17:00:00",
    }]
    actions = {
        getRequire:action((status)=>{

        }),
        getApplyPerson:action((id)=>{
            return [
                {name:"射击馆",applyTime:"2018-9-3 13:00:00",describe:"一个方案描述",annex:"xxx.png",requireId:id,shopId:1},
                {name:"射击馆",applyTime:"2018-9-3 13:00:00",describe:"一个方案描述",annex:"xxx.png",requireId:id,shopId:2},
                {name:"射击馆",applyTime:"2018-9-3 13:00:00",describe:"一个方案描述",annex:"xxx.png",requireId:id,shopId:3}
                ]
        }),
        accept:action((ShopId,requireId)=>{

        }),
        cancelRequire: action((id) => {
            let index=this.requireList.findIndex(item => item.id === id);
            if(index!=-1)
                this.requireList.splice(index, 1)
            console.log(this.requireList)
        }),
        setCurrentPage: action((page) => {
            this.page={
                currentPage:page,
                pageSize:this.page.pageSize
            }
        }),
        setShowSize: action((page,pageSize) => {
            this.page={
                currentPage:this.page.currentPage,
                pageSize:pageSize
            }
        })
    }
}

export default new RequireListStore()